<script>
import Vue from 'vue'
import APPUpdate from '@/js_sdk/zhouWei-APPUpdate/APPUpdate/index.js';
export default {
	created() {
		// #ifdef APP-PLUS
		plus.navigator.closeSplashscreen();
		// #endif
	},
	onLaunch: function() {
		console.log('App Launch');
		uni.getSystemInfo({
			success: function(e) {
				// #ifndef MP
				Vue.prototype.StatusBar = e.statusBarHeight;
				if (e.platform == 'android') {
					Vue.prototype.CustomBar = e.statusBarHeight + 50;
				} else {
					Vue.prototype.CustomBar = e.statusBarHeight + 45;
				}
				// #endif

				// #ifdef MP-WEIXIN
				Vue.prototype.StatusBar = e.statusBarHeight;
				let custom = wx.getMenuButtonBoundingClientRect();
				Vue.prototype.Custom = custom;
				Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
				// #endif

				// #ifdef MP-ALIPAY
				Vue.prototype.StatusBar = e.statusBarHeight;
				Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
				// #endif
			}
		});
		this.$mqtt.initMqtt()
		setTimeout(() => {
			APPUpdate(true);
		}, 2000);
		setTimeout(() => {
			uni.setTabBarBadge({
				index: 0,
				text: String(uni.getStorageSync('logListLength'))
			});
		}, 1000);
	},
	onShow: function() {
		console.log('App Show');
	},
	onHide: function() {
		console.log('App Hide');
	},
	// 监听logList长度
	watch:{
		'$store.getters.getLogLength':{ 
			handler(val, oldVal) {
				console.log(val) 
			      if(val==0){
			      	uni.removeTabBarBadge({
			      		index: 0
			      	});
			      }else{
			      	uni.setTabBarBadge({
			      		index: 0,
			      		text: String(val) 
			      	});
			      }
			    },
			    deep: true
		}
	},
};
</script>

<style>
	@import url("./common/css/iconfont.css");
	body{
		/* background: #FFFFFF !important; */
	}
	/* page
	{
		padding-top: 60rpx;
	} */
/*每个页面公共css */
</style>
